home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
util
/
libs
/
MultiReq.lha
/
MultiReq
/
C
/
include
/
libraries
/
multireq.h
< prev
Wrap
C/C++ Source or Header
|
1992-11-12
|
14KB
|
390 lines
/********************************************************/
/* */
/* multireq.h -- definition of library structures */
/* */
/* Copyright (c) 1992 by Andreas Krebs */
/* */
/********************************************************/
#ifndef LIBRARIES_MULTIREQ_H
#define LIBRARIES_MULTIREQ_H
#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif /* EXEC_TYPES_H */
#ifndef EXEC_LIBRARIES_H
#include <exec/libraries.h>
#endif /* EXEC_LIBRARIES_H */
#ifndef INTUITION_INTUITION_H
#include <intuition/intuition.h>
#endif /* INTUITION_INTUITION_H */
/* Defines for library */
#define MultiReqName "multireq.library"
/********************************/
/* data structures */
/********************************/
/*********************************** FileList ***********************************/
/* */
/* The FileList structure contains a complete Directory with all informations. */
/* */
/* The following structures contain some informations, that may never be */
/* changed by the user, and other informations, that can be changed. */
/* The structure elements mark with "CSU - Can be Set by User", can be set */
/* by the user, all others should NEVER be changed !!! */
/* All structure elements with the ending Buff are pointers to a already */
/* allocated string buffer, so do not change this pointers. Instead use */
/* StrCpy to fill this buffers with a string. */
/* */
/********************************************************************************/
struct FileList
{
APTR ListKey; /* Key to mem for entries of list */
struct FileEntry *FileList; /* Ptr to first entry in list */
APTR FileListPos; /* Current pos of ptr in list mem */
APTR FileListEnd; /* end of list mem */
struct FileEntry *FirstShown; /* Ptr to first shown (not hidden !) entry in list */
struct FileEntry *FirstDisplayed; /* Ptr to first displayed entry */
struct FileEntry *SelectedEntry; /* Ptr to selected file */
APTR Lock; /* filelock for list (if still reading or stopped) */
struct FileInfoBlock *FInfo; /* ptr to FInfoBlock structure */
UBYTE *DrawerBuff; /* Buffer containing the Drawer [CSU] */
UWORD AutoRead; /* automatically read in dir [CSU] */
UWORD DirNum; /* Number of dirs read in */
UWORD FileNum; /* Number of files read in */
};
/* possible flags for AutoRead */
#define NO_AUTOREAD 0 /* don't read in dir automatically */
#define DO_AUTOREAD 1 /* automatically read in dir, when filelist activated */
/*************************** FileReq ****************************/
/* */
/* The FileReq structure as returned from InitFileReq() */
/* */
/****************************************************************/
struct FileReq
{
UBYTE *TitleString; /* ptr to title string or NULL (no title) [CSU] */
UBYTE *OkayString; /* ptr to string for okay-gadget or NULL */
/* ("Okay" used as text) [CSU] */
UWORD LeftEdge; /* leftedge of filereqwindow [CSU] */
UWORD TopEdge; /* topedge of filereqwindow [CSU] */
UWORD Width; /* width of window (NOT USED YET) */
UWORD Height; /* height of window (NOT USED YET) */
APTR AddInfo; /* additional info (NOT USED YET) */
UBYTE *FileNameBuff; /* when returning this buffer contains the */
/* active filename with full path */
UWORD ReturnStatus; /* MCD_OKAY, MCD_CANCEL, or stuff like that */
UBYTE ActiveList; /* 0 (list 1) or 1 (list 2) [CSU] */
UBYTE ShowInfo; /* show or hide ".info"-files [CSU] */
struct ReqBase *BaseAddress; /* Base address of data memory (NEVER change !!!) */
UBYTE *FileBuff; /* buffer containing filename [CSU] */
UBYTE *ShowBuff; /* buffer with a wildcard string for the files */
/* to be shown (e.g: "*.c|*.h") [CSU] */
UBYTE *HideBuff; /* buffer with wildcard string for the files */
/* to be hidden [CSU] */
UWORD FileListNum; /* number of filelists (this version only */
/* supports 2 filelists) */
struct FileList FileList[2]; /* first and second filelist */
};
/* The possible ReturnStatus flags */
#define RET_ERROR 0 /* something went wrong, (no FilReq structure or */
/* unable to open window) */
#define RET_CANCEL 1 /* Cancel-Gadget selected */
#define RET_CLOSE 2 /* Close-Gadget selected */
#define RET_FILE 3 /* RETURN pressed in File-Gadget */
#define RET_DOUBLE 4 /* DoubleClick on File-Entry */
#define RET_OKAY 5 /* Okay-Gadget selected */
/* The possible flags for ShowInfo */
#define HIDE_INFO 0 /* Hide all files ending with ".info" */
#define SHOW_INFO 1 /* don't hide ".info" files */
/********************************* MRText *******************************/
/* */
/* The MRText structure, usefull if you have many texts of the same */
/* font and style, cause its shorter than IntuiText */
/* */
/************************************************************************/
struct MRText
{
UWORD LeftEdge; /*left position of text */
UWORD TopEdge; /*top position of text */
UBYTE Pen; /*FrontPen of text */
UBYTE Length; /*Length of text, avoids StrLen to be called */
UBYTE *Text; /*ptr to text string */
};
/*********************************************************/
/* the possible styles for the DrawGadgetBorder-function */
/*********************************************************/
#define NOBORDER 0 /* draw no border */
#define BOOLBORDER 1 /* draw a simple 3D-Button */
#define FILLEDBORDER 2 /* draw a filled 3D-Button */
#define STRBORDER 3 /* draw a StringGadget-Border */
#define FILLEDSTRBORDER 4 /* draw a filled StringGadget-Border */
#define CYCLEIMG 0x80 /* draw a cycle image */
/********************************************************************************/
/* The DrawGadgetBorder-function uses the UserData part of the Gadget structure */
/* for some additional information in the following way */
/* 1. Byte: Style, 2. Byte: Pen1, 3. Byte: Pen2, 4.Byte: FillPen (if used) */
/* */
/* The following MACRO helps you to set this value */
/********************************************************************************/
#define BORDER(s,p1,p2,f) (APTR)(((ULONG)s << 24) | ((ULONG)p1 << 16) | ((ULONG)p2 << 8) | (ULONG)f)
/****************************** MultiReqBase ****************************/
/* */
/* the MultiReqBase structure is almost a normal LibBase structure */
/* */
/************************************************************************/
struct MultiReqBase
{
struct Library LibNode;
UBYTE Flags; /* some flags for lib */
UBYTE pad; /* make EVEN address */
APTR SegList; /* bptr to first segement of library */
};
/************************************************************************/
/* All following structures are private ! DO NOT USE THEM !!!! */
/************************************************************************/
#ifdef MULTIREQ_PRIVATE
/* if you wish to use the following structures (????) add the following */
/* command before #include <libraries/multireq.h>: */
/* #define MULTIREQ_PRIVATE
*/
/******************************** FileEntry *****************************/
/* */
/* The FileEntry-structure contains a file or directory. */
/* */
/************************************************************************/
struct FileEntry
{
struct FileEntry *NextEntry; /* Next entry in list */
struct FileEntry *LastEntry; /* Last entry in list */
APTR ImageData; /* or FileSize for files */
UBYTE Pen; /* textcolor of entry (also as type ID) */
UBYTE Length; /* length of name */
UBYTE *Name; /* ptr to name */
UBYTE Shown; /* entry hidden or shown ? */
UBYTE Selected; /* 0 = Not Selected, 1 = Selected */
struct FileEntry *NextShown; /* Next shown entry in list */
struct FileEntry *LastShown; /* Last shown entry in list */
};
/* possible Pens */
#define FILE_PEN 1 /* entry is a file, so use pen 1 */
#define DIR_PEN 2 /* entry is a directory, so use pen 2 */
/* possible Shown flags */
#define ENTRY_HIDDEN 0 /* entry is not show in list */
#define ENTRY_SHOWN 1 /* entry is shown in list */
/* possible Selected flags */
#define ENTRY_UNSEL 0 /* entry is not selected */
#define ENTRY_SEL 1 /* entry is selected */
/******************************** VolEntry ******************************/
/* */
/* The VolEntry structure contains an entry of the volumes list. */
/* */
/************************************************************************/
struct VolEntry
{
struct VolEntry *NextEntry; /* next entry in list */
struct VolEntry *LastEntry; /* last entry in list */
APTR ImageData; /* ptr to imagedata of image to be displayed */
UBYTE Pen; /* textcolor of entry (also type ID) */
UBYTE Length; /* length of name */
UBYTE *Name; /* ptr to name with an added ":" */
};
/* possible Pens */
#define DEVICE_PEN 1 /* pen for devices like (DF0:, ...) */
/* pen for dirs (again 2) */
#define VOLUME_PEN 3 /* pen for volumes */
/***************************** MRTime ***************************/
/* */
/* The MRTime structure is needed to save the time of a message */
/* */
/****************************************************************/
struct MRTime
{
ULONG Seconds; /* seconds part of the time */
ULONG Micros; /* micros part of the time */
};
/************************************ ReqBase ***********************************/
/* */
/* The ReqBase is NOT the LibraryBase of multireq.library, it's a structure */
/* containing all temporary information needed by the FileRequester */
/* This structure is create by InitFileReq and setup with the values, but */
/* because of it's size and it's important information, the user gets the */
/* FileReq structure instead of this one. */
/* */
/********************************************************************************/
struct ReqBase
{
APTR begSP; /* initial SP of FileReq */
APTR readSP; /* initial SP of ReadProcess */
struct Remember *ReqKey; /* Key for AllocRemember */
struct Window *ReqWin; /* ptr to FileReq-window */
struct RastPort *rp; /* ptr to FileReq-window's RastPort */
struct FileReq *FileReq; /* ptr to FileReq structure */
struct FileList *ActiveList; /* ptr to currently active list (1 or 2) */
struct MsgPort *ReqPort; /* ptr to port of FileReq */
struct MsgPort *ReadPort; /* ptr to port of ReadProcess */
struct ReadMessage *ReqMsg; /* ptr to mem for FileReq messages */
struct ReadMessage *ReadMsg; /* ptr to mem for ReadProcess messages */
struct VolEntry CurrentVol; /* mem for current dir vol entry (always first) */
struct VolEntry *VolList; /* ptr to list with all volumes */
struct VolEntry *FirstVol; /* first shown volume */
struct VolEntry *LastVol; /* last shown volume */
UWORD VolNum; /* number of volumes in list */
struct Remember *VolKey; /* alloc key for volumes mem */
APTR VolListPos; /* current pos in volumes mem */
APTR VolListEnd; /* end of volumes mem */
UWORD ShownNum; /* number of files+dirs shown (not hidden!) */
UWORD SelectedPos; /* pos of last selected entry (0 to 13) */
struct FileEntry *FirstFile; /* first shown entry in display */
struct FileEntry *LastFile; /* last shown entry in display */
UBYTE *DrawerBuff; /* ptr to enough mem to work with drawer buffer */
UBYTE *UndoDrawerBuff; /* ptr to a undobuffer */
struct MRTime MsgTime; /* for secs and micros of this message */
struct MRTime LastTime; /* secs and micros of last message */
/* the following part contains all gadgets */
struct Image FilePropImage; /* the Image structures for the PropGadgets */
struct Image VolPropImage;
struct StringInfo ShowSInfo; /* the StringInfo structures for the String-Gadget */
struct StringInfo HideSInfo;
struct StringInfo DrawerSInfo;
struct StringInfo FileSInfo;
struct PropInfo VolPInfo; /* the PropInfo structures for the Prop-Gadgets */
struct PropInfo FilePInfo;
struct Gadget CloseGadg; /* the gadgets itself */
struct Gadget DepthGadg;
struct Gadget InfoGadg;
struct Gadget SwitchGadg;
struct Gadget Copy12Gadg;
struct Gadget Copy21Gadg;
struct Gadget ShowGadg;
struct Gadget HideGadg;
struct Gadget ScanGadg;
struct Gadget StopGadg;
struct Gadget OkayGadg;
struct Gadget CancelGadg;
struct Gadget DrawerGadg;
struct Gadget FileGadg;
struct Gadget VolUpGadg;
struct Gadget VolDownGadg;
struct Gadget VolPropGadg;
struct Gadget ParentGadg;
struct Gadget FileUpGadg;
struct Gadget FileDownGadg;
struct Gadget FilePropGadg;
struct Gadget DragGadg;
};
/********************************** ReadMessage *********************************/
/* */
/* The ReadMessage is used for communication between FileReq and ReadProcess. */
/* */
/********************************************************************************/
struct ReadMessage
{
struct Node rdm_Node;
struct MsgPort *rdm_ReplyPort;
UWORD rdm_Length; /*length is 10 */
UWORD Command; /*message command */
APTR Data1; /*2 LONGS for datas to send */
APTR Data2;
};
/************************/
/* Message Commands */
/************************/
#define MCD_NOP 0 /*do nothing */
/* msgs from FileReq to ReadProcess */
#define MCD_READDIR 1 /* readin dir */
#define MCD_SCAN 2 /* same as read, but continues a stopped reading proc */
#define MCD_STOP 3 /* stop read in */
#define MCD_QUIT 4 /* quit ReadProcess, set DO_AUTOREAD, if still reading */
/* msgs from ReadProcess to FileReq */
#define MCD_REDISPLAY 10 /* redisplay filelist (something changed) */
#define MCD_SIZEPROP 11 /* change size of PropGadget (another file read in) */
#define MCD_DONE 12 /* directroy totally read in */
#define MCD_ERROR 13 /* 13 is a great number for an error, is it ?? */
#define MCD_EXIT 14 /* only send before ReadProcess is going down */
/* cause FileReq is interested in me going down */
#endif /* MULTIREQ_PRIVATE */
#endif /* LIBRARIES_MULTIREQ_H */